package models;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import play.data.validation.Required;
import play.db.jpa.GenericModel;

@Entity
public class Show extends GenericModel {
	
	/* Variable Definitions */
	
	@Id
	private String name;
	
	@Required
	private String description;
	
	@Required
	private Date startTime;
	
	@Required
	private Date endTime;
	
	@Required
	@ManyToOne
	@JoinColumn(name = "channel_id")
	private Channel channel;
	
	/* End of Variable Definitions */
	
	
	/* Getter and Setter Methods */
	
	// -- name section --
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	// -- description section
	
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
	// -- startTime section --
	
	public Date getStartTime() {
		return startTime;
	}
	
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
	
	// -- endTime section --
	
	public Date getEndTime() {
		return endTime;
	}
	
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	
	// -- channel section --
	
	public Channel getChannel() {
		return channel;
	}
	
	public void setChannel(Channel channel) {
		this.channel = channel;
	}
	
	/* End of Getter and Setter Methods */
	
	
	/* Other Methods */
	
	public String toString() {
		return name;
	}
	
	public static boolean isExist(String value) {
		return Show.find("byName", value) != null;
	}
	
	/* End of Other Methods */
	
}